package com.example.qxfw.cshx.service.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.qxfw.common.entity.zy.CcshxImpDot;
import com.example.qxfw.cshx.mapper.CcshxImpDotMapper;
import com.example.qxfw.cshx.service.CcshxImpDotService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CcshxImpDotServiceImpl implements CcshxImpDotService {

    @Autowired
    private CcshxImpDotMapper ccshxImpDotMapper;

    @Override
    public List<CcshxImpDot> getList(String joinStation) {
        return ccshxImpDotMapper.selectList1(joinStation);
    }

    @Override
    public List<CcshxImpDot> getList1(String name) {
        return ccshxImpDotMapper.selectList2(name);
    }

    @Override
    public List<CcshxImpDot> getList2() {
        return ccshxImpDotMapper.selectList(Wrappers.<CcshxImpDot>lambdaQuery().orderByAsc(CcshxImpDot::getId));
    }

    @Override
    public Integer save(CcshxImpDot ccshxImpDot) {
        return ccshxImpDotMapper.insert(ccshxImpDot);
    }

    @Override
    public Integer update(CcshxImpDot ccshxImpDot) {
        return ccshxImpDotMapper.update(ccshxImpDot, Wrappers.<CcshxImpDot>lambdaUpdate()
                .eq(CcshxImpDot::getId,ccshxImpDot.getId()));
    }

    @Override
    public Integer delete(String id) {
        return ccshxImpDotMapper.delete(Wrappers.<CcshxImpDot>lambdaQuery()
                .eq(CcshxImpDot::getId,Integer.parseInt(id)));
    }
}
